package com.trw.trp.action;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.trw.trp.bean.ModelBean;
import com.trw.trp.dao.DaoFactory;
import com.trw.trp.dao.ModelDao;

public class UserProfileAction extends AbstractAction {

	private String status;

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public void getModels() throws Exception {
		ModelDao dao = DaoFactory.getModelDao();
		int theStatus = 1;
		if (!StringUtils.isEmpty(status)) {
			try {
				theStatus = Integer.parseInt(status);
			} catch (NumberFormatException e) {
				e.printStackTrace();
			}
		}
		List<ModelBean> modelList = dao.getModels(theStatus);
		writeJSON(modelList);
		return;
	}

}
